import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/process/closure_approval_process_widget.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/emergency_plan_details_controller.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/evaluation_record/evaluation_record_view.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/memo_record/memo_record_view.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/plan_information/plan_information_view.dart';
import 'package:enterprise_v6_app/app/modules/application/emergency/emergency_plan/emergency_plan_details/revision_record/revision_record_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

/// 应急预案详情
class EmergencyPlanDetailsPage extends StatelessWidget {
  EmergencyPlanDetailsPage({super.key});

  final controller = Get.put(EmergencyPlanDetailsController());

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 4,
      child: GetBuilder(
          init: controller,
          builder: (_) {
            return Scaffold(
                appBar: CustomAppBar(titleText: '预案查看'),
                body: Container(
                  color: const Color(0xffF5F5F6),
                  child: Column(
                    children: [
                      Container(
                        height: 54.w,
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(8.r),
                        ),
                        child: TabBar(
                          controller: controller.tabController,
                          tabs: const [
                            Tab(text: '预案信息'),
                            Tab(text: '备案记录'),
                            Tab(text: '修订记录'),
                            Tab(text: '评估记录'),
                            Tab(text: '审批流程'),
                          ],
                          dividerColor: Colors.transparent,
                          labelPadding: EdgeInsets.only(bottom: 20.w),
                          labelStyle: TextStyle(
                            fontSize: 16.sp,
                            fontWeight: FontWeight.w500,
                          ),
                          unselectedLabelStyle: TextStyle(
                            fontSize: 16.sp,
                            fontWeight: FontWeight.w500,
                          ),
                          labelColor: Colors.black,
                          unselectedLabelColor: const Color(0xffA0A7B5),
                          indicatorPadding: EdgeInsets.only(top: 35.w, bottom: 10.w),
                          indicator: const BoxDecoration(
                            image: DecorationImage(
                              image: AssetImage(
                                'assets/images/icon_select_arc.png',
                              ),
                            ),
                          ),
                        ),
                      ),
                      Expanded(
                        child: Container(
                          padding: EdgeInsets.only(top: 14.w),
                          color: const Color(0xffF5F5F6),
                          child: TabBarView(
                            controller: controller.tabController,
                            children: [
                              PlanInformationPage(),
                              MemoRecordPage(),
                              RevisionRecordPage(),
                              EvaluationRecordPage(),
                              ClosureApprovalProcessWidget(nodeList: controller.nodeList, isReject: controller.state == 5)
                              // EmergencyCommonWidget.getApprovalProcessWidget(processList: controller.processList),
                            ],
                          ),
                        ),
                      ),
                    ],
                  ),
                ));
          }),
    );
  }
}
